package com.jlboot.app.index.controller;

import com.jfinal.core.Controller;
import com.jlboot.app.index.vo.IndexLoginUser;
import com.jlboot.app.index.vo.LoginVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;


/**
 * @author wangsanfei
 * @version 1.0
 * Create by 2024/3/13 15:33
 */
//@OpenAPIDefinition(
//        info = @Info(
//                title = "the title",
//                version = "0.0",
//                description = "My API",
//                license = @License(name = "Apache 2.0", url = "http://foo.bar"),
//                contact = @Contact(url = "http://gigantic-server.com", name = "Fred", email = "Fred@gigagantic-server.com")
//        ),
//        tags = {
//                @Tag(name = "Tag 1", description = "desc 1", externalDocs = @ExternalDocumentation(description = "docs desc")),
//                @Tag(name = "Tag 2", description = "desc 2", externalDocs = @ExternalDocumentation(description = "docs desc 2")),
//                @Tag(name = "Tag 3")
//        },
//        externalDocs = @ExternalDocumentation(description = "definition docs desc"),
//        security = {
//                @SecurityRequirement(name = "req 1", scopes = {"a", "b"}),
//                @SecurityRequirement(name = "req 2", scopes = {"b", "c"})
//        },
//        servers = {
//                @Server(
//                        description = "server 1",
//                        url = "http://foo",
//                        variables = {
//                                @ServerVariable(name = "var1", description = "var 1", defaultValue = "1", allowableValues = {"1", "2"}),
//                                @ServerVariable(name = "var2", description = "var 2", defaultValue = "1", allowableValues = {"1", "2"})
//                        })
//        }
//)
@Path("/index")
public class IndexController extends Controller {

    @POST
    @Path("/login")
    @Consumes("application/json")
    @Operation(summary = "Update an existing pet",

        tags = {"pets2"},

        security = @SecurityRequirement(name = "petstore-auth",scopes = "write:pets"),

        requestBody = @RequestBody(
                description = "Pet object that needs to be added to the store"
                , required = true,
                content = @Content(
                        schema = @Schema(implementation = LoginVo.class))),

        responses = {
                    @ApiResponse(
                            content = @Content(mediaType = "application/json",
                                    schema = @Schema(implementation = IndexLoginUser.class))),
                    @ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
                    @ApiResponse(responseCode = "404", description = "Pet not found"),
                    @ApiResponse(responseCode = "405", description = "Validation exception")
        }
    )
    public void loginAction(){

    }

}
